home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / FCOPY31.ARJ / README < prev    next >
Text File  |  1992-05-12  |  3KB  |  88 lines

  1. FCOPY - C function to perform file copies.
  2. Version 2.1
  3.  
  4.      This archive contains the following files:
  5.  
  6.           readme (this file)
  7.           fcopy.c
  8.           fcopy.h
  9.           copyfile.asm
  10.           farread.asm
  11.           farwrite.asm
  12.           copytest.c
  13.           copytest.exe
  14.  
  15.      fcopy is a C function that copies one file to another, much like
  16.      the DOS COPY command.  It operates on single files only (i.e., does
  17.      not accept wildcards).  To copy multiple files, fcopy must be used
  18.      in a loop with findfirst and findnext functions (Turbo C++ library
  19.      -- other compilers have similar names).
  20.  
  21.      fcopy also does not check to see if the specified files are the
  22.      same, so it is up to the calling function to verify that the two
  23.      file specs do not, in fact, refer to the same file.
  24.  
  25.      Version 2.1 contains the _copyfile code improvements of version 3.1
  26.      with the simplified version of fcopy 2.0.
  27.  
  28.      Version 2.1 of fcopy calls the function _copyfile (written in
  29.      assembler) to perform the actual reads and writes.  Source is
  30.      contained in the file COPYFILE.ASM.
  31.  
  32.      Version 1.1 of fcopy used separate functions _farread and _farwrite
  33.      to perform the reads and writes to a far buffer.  Since these two
  34.      can be used as general purpose functions, they have been added to
  35.      this archive.
  36.  
  37.      The new version 2.1 (using _copyfile) has a slight size and speed
  38.      advantage over the earlier version, in that the far pointer to the
  39.      file buffer needs to be loaded only once for the entire copy
  40.      operation.  The copy loop is completely contained within the single
  41.      assembler module.
  42.  
  43.      Usage for the function in a C program is as follows:
  44.  
  45.           #include "fcopy.h"
  46.           int fcopy (char *sourcename, char *targetname)
  47.  
  48.      The function returns 0 on success, and -1 if an error occurred.  On
  49.      failure, the global variables errno and _doserrno are set to one of
  50.      the following:
  51.  
  52.           EINVFNC     Invalid function number  (1)
  53.           ENOFILE     File not found  (2)
  54.           ENOPATH     Path not found  (3)
  55.           EMFILE      Too many open files  (4)
  56.           EACCESS     Permission denied  (5)
  57.           EBADF       Bad file number  (6)
  58.           ECONTR      Memory blocks destroyed  (7)
  59.           ENOMEM      Not enough core  (8)
  60.           EINVMEM     Invalid memory block address  (9)
  61.           EINVACC     Invalid access code  (12)
  62.                -2     Target disk full  (-2)
  63.  
  64.      See the source code for more information.
  65.  
  66.      A short demo program (COPYTEST.EXE) is included.  It prompts the
  67.      user for source and target filenames and then performs the copy. If
  68.      an error occurred during the copy operation, an error message is
  69.      displayed.  (This simple program does NOT test the source and
  70.      target filenames to detect whether they actually refer to the same
  71.      file.)
  72.  
  73.      To compile the demo program using Turbo C++, use the following
  74.      command line (for the small memory model):
  75.  
  76.          tcc -ms copytest fcopy copyfile.asm
  77.  
  78.      Other memory models are supported; compile by defining the symbol
  79.      _model=[model], where model is small, compact, medium, large, or
  80.      huge.  Example:
  81.  
  82.          tcc -ml -Td_model=large copytest fcopy copyfile.asm
  83.  
  84.  
  85.      Ray Waters
  86.      CompuServe ID 72261,33
  87.      May 12, 1992
  88.